home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4747 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: taco.cc.ncsu.edu!rbsteven
  2. From: rbsteven@eos.ncsu.edu (Robert Barclay Stevenson)
  3. Newsgroups: comp.lang.c++
  4. Subject: I/O Streams...Question?
  5. Date: 31 Jan 1996 22:04:53 GMT
  6. Organization: North Carolina State University, Project Eos
  7. Distribution: world
  8. Message-ID: <4eop25$8um@taco.cc.ncsu.edu>
  9. Reply-To: rbsteven@eos.ncsu.edu (Robert Barclay Stevenson)
  10. NNTP-Posting-Host: prez.sod.ncsu.edu
  11. Keywords: streams, c++, question, help
  12. Originator: rbsteven@prez.sod.ncsu.edu
  13.  
  14.  
  15. Hey there...
  16.  
  17.      I am relatively experienced with C programming, but recently adopted C++
  18. for a couple of short projects.  Basically I would like to use the iostream
  19. class to handle stdin through a loop to build a list, something like:
  20.  
  21. while (cin >> inputList[input_data]) {
  22.  
  23. /*blah, blah, blah...*/
  24.  
  25. }
  26.  
  27. Problem is...I can't get out of the loop without checking some pre-condition
  28. and breaking out.  I could get the user to put a sentinel like 'Q' or something
  29. at the end of the stream, but it would not really be the ideal solution.  
  30. Anyways if any out there has a suggestion to get the loop to evaluate false and
  31. fail so the rest of the code that follows could be used I'd be in appreciation...
  32.  
  33. Thanks in advance...
  34. -- 
  35. --------------------------------------------------------------------------------
  36. Robert Stevenson                 | "Virtual Reality won't merely replace TV.
  37. Sys Adm/Design Research          |  It will eat it alive." A.C. Clarke
  38. Virtual Environments Lab         | 
  39.